// 
//  Artist.m
//  XMLtoCD08
//
//  Created by Miles on 10-03-24.
//  Copyright 2010 Miles Thorogood
//  greenmeat.net. All rights reserved.
//

#import "Artist.h"

@implementation Artist 

@dynamic medium;
@dynamic artistThumbnailImage;
@dynamic filepath;
@dynamic lastname;
@dynamic firstname;
@dynamic date;
@dynamic program;
@dynamic text;
@dynamic artistImage;

+ (void)initialize {
	if (self == [Artist class] ) {
		UIImageToDataTransformer *transformer = [[UIImageToDataTransformer alloc] init];
		[NSValueTransformer setValueTransformer:transformer forName:@"UIImageToDataTransformer"];
	}
}

@end

@implementation UIImageToDataTransformer


+ (BOOL)allowsReverseTransformation {
	return YES;
}

+ (Class)transformedValueClass {
	return [NSData class];
}


- (id)transformedValue:(id)value {
	NSData *data = UIImagePNGRepresentation(value);
	return data;
}


- (id)reverseTransformedValue:(id)value {
	UIImage *uiImage = [[UIImage alloc] initWithData:value];
	return [uiImage autorelease];
}

@end
